<%@ page language="java" contentType="text/html;charset=UTF-8" %><%@ include file="../../inc/global.jsp" 
%><compress:html enabled="true" removeComments="false" compressJavaScript="true" yuiJsDisableOptimizations="true">
<!doctype html>
<html>
<head>
<title>${adminGlobalConfig.name}</title>
<%@include file="../head.jsp" %>
<style type="text/css">
#goodsList table tr, #goodsList table td {
	height:22px;
}
#items li {height:35px; line-height:35px; display:block;}
#items li.isReturn {background:#ffee66;}
</style>
<script type="text/javascript">
function init() {
	$('#items input[type=checkbox]').change(function(){
		var checked = ($(this).is(':checked'));
		var o = ($('#returnMoney').val());
		if(o != undefined && o.length > 0) {
			o = parseFloat(o);
		}
		var m = parseFloat($(this).next().val());
		if(checked) {
			$(this).parent().parent().addClass('isReturn');
			if(o != undefined) {
				m = o+m;
			}
		} else {
			$(this).parent().parent().removeClass('isReturn');
			if(o != undefined) {
				m = o-m;
			}
		}
		if(m>${vo.realPayables}){
			m = ${vo.realPayables};
		}
		else if(m < 0) {
			m = 0;
		}
		$('#returnMoney').val(m);
	});
	$('form').submit(function(){
		$('#submit').attr('disabled', 'true');
	});
}
$(document).ready(function() {
	init();
});
//
</script> 
</head>
<body>
<div class="wrapper">
<%@include file="../header.jsp" %>
<div class="body">
<div class="form">
<form action="/a/sell/return" id="form" name="form" method="POST">
<table>
<tr><th>订单编号</th><td>${vo.id}</td></tr>
<tr>
<th>顾客</th>
<td>
<div id="customer">
姓名：${vo.customer.name}
</div>
<div id="customer">
电话：${vo.customer.mobile} ${vo.customer.tel} 
</div>
</td>
</tr>
<tr>
<th>村庄</th>
<td>
${vo.town.name}${vo.village.name}
</td>
</tr>
<tr>
<th>产品</th>
<td>
<ul id="items">
<c:forEach var="item" items="${vo.itemList}">
<li<c:if test="${item.item.isReturn}"> class='isReturn'</c:if>>
<label for="item_${item.item.id}">
<c:if test="${item.item.isReturn}">
<input type="checkbox" id="item_${item.item.id}" name="item" value="${item.item.id}" checked disabled="true"/>
</c:if>
<c:if test="${!item.item.isReturn}">
<input type="checkbox" id="item_${item.item.id}" name="item" value="${item.item.id}"/>
</c:if>
<input type="hidden" id="payables_${item.item.id}" name="payables" value="${item.payables}" />
${item.brand.name} ${item.category.name} ${item.goods.name} (${item.goods.displayName}) / <span class="green">单价：${item.payables}</span>
</label>
</li>
</c:forEach>
</ul>
</td>
</tr>
<tr>
<th>销售金额</th>
<td>
${vo.realPayables}
</td>
</tr><tr>
<th>退货金额</th>
<td>
<input type="text" id="returnMoney" name="returnMoney" value="0" />
</td>
</tr>
<tr>
<th></th>
<td>
<span id="remind" class="error"></span>
<input type="hidden" id="backURL" name="backURL" value="${backURL}" />
<input type="submit" id="submit" name="submit" value="确定退货" />
</td>
</tr>
</table>
</form>
</div>
<!--  -->
</div>
</div>
</body>
</html>
</compress:html>